package com.cloud.item.client.fallback;

import com.cloud.item.client.OrderClient;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lscl
 * @version 1.0
 * @intro: Order服务远程调用失败的降级处理
 */
@Component
public class OrderClientFallBack implements OrderClient {
    @Override
    public Map testHystrix(String flag) {
        return new HashMap() {{
            put("flag", true);
            put("message", "触发testHystrix降级方法！");
            put("statusCode", "400");
            put("flag", flag);
        }};
    }

    @Override
    public Map findById(Integer id) {
        return new HashMap() {{
            put("flag", true);
            put("message", "触发findById降级方法！");
            put("statusCode", "400");
            put("id", id);
        }};
    }

    @Override
    public Map findAll() {
        return new HashMap() {{
            put("flag", true);
            put("message", "触发findAll降级方法！");
            put("statusCode", "400");
        }};
    }
}
